package com.huluspace.communication.controller;

import com.huluspace.communication.model.LoginRequest;
import com.huluspace.communication.model.LoginResponse;
import org.springframework.web.bind.annotation.*;

@RestController
public class LoginController {

  @PostMapping("/login")
  public LoginResponse login(@RequestBody LoginRequest request) {
    String username = request.getUsername();
    String password = request.getPassword();
    if ("admin".equals(username) && "123456".equals(password)) {
      return new LoginResponse(200, "登录成功", username);
    } else {
      return new LoginResponse(401, "用户名或密码错误", null);
    }
  }
}

